package com.student.xujiang.myallstudent;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.student.xujiang.R;

public class MainActivity extends AppCompatActivity {

    //为了解耦 就不用注解了，毕竟注解也需要学习时间
    private RecyclerView mRecyclerView;
    //让Adapter可以获取数据
    private String[] mDatas = new String[]{"RecyclerView","glide","okhttpandhttp","EventBus","retrofit2","rxjava1main","gsonandjackson","Login","baserxlifecycleactivity","rxjava2MainActivity"};

    private MainAdapter mAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mRecyclerView = (RecyclerView) findViewById(R.id.main_list_recycler);

        ////确定你的布局，在这里是线性布局
        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));

        //如果可以确定每个item的高度是固定的，设置这个选项可以提高性能
        //mRecyclerView.setHasFixedSize(true);

        //设置Adapter
        mAdapter = new MainAdapter(this,mDatas);
        mRecyclerView.setAdapter(mAdapter);


    }
}
